#pragma once

#include <typedef.h>

#if defined(CONFIG_TAR4ESP32)
#include "driver/i2c_master.h"
#endif

class I2C
{
public:
	I2C(uint16_t devAddr);
	virtual ~I2C();

	int Write(uint8_t* data, uint16_t len);
	int Read(uint8_t* txdata, uint16_t txlen, uint8_t* rxdata, uint16_t rxlen);

private:
#if defined(CONFIG_TAR4ESP32)
	i2c_master_bus_config_t i2c_bus_config;
	i2c_device_config_t i2c_dev_conf;
	i2c_master_bus_handle_t bus_handle;
	i2c_master_dev_handle_t dev_handle;
#endif
};
